package com.lxyk.service.imol;

import com.lxyk.mapper.AdminMapper;
import com.lxyk.pojo.Admin;
import com.lxyk.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AdminServiceImpl implements AdminService {

    @Autowired
    private AdminMapper adminMapper;

    public Integer addAdmin(Admin admin) {
        return adminMapper.addAdmin(admin);
    }

    public Integer update(Admin admin) {
        return adminMapper.update(admin);
    }

    public Integer checkUserName(String username) {
        return adminMapper.checkUserName(username);
    }

    public Admin findByCode(String code) {
        return adminMapper.findByCode(code);
    }

    @Override
    public Admin login(Admin admin) {
        Admin login = adminMapper.login(admin);
        if (login!=null){
            login.setPassword("******");
        }
        return login;
    }
}
